﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Xml;
using System.Data;
using BusinessObjects.BO_GetObjects;

public partial class Pages_Site : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadBanner();
            LoadFooter();
            LoadMenuFooter();
        }
    }

    protected void LoadMenuFooter()
    {
        try
        {
            DataTable objDT = BO_Categories.GetMenu(0);
            if (objDT.Rows.Count > 0)
            {
                rptFooterMenu.DataSource = objDT;
                rptFooterMenu.DataBind();
            }
        }
        catch (Exception)
        {


        }
    }

    protected void LoadBanner()
    {
        try
        {
            string fname = Server.MapPath("~/upload/xml/banner.xml");
            if (File.Exists(fname))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(fname);
                XmlNode root = doc.DocumentElement;
                XmlNodeList list = root.ChildNodes;
                string logo = list.Item(0).ChildNodes.Item(0).InnerText;
                string banner = list.Item(1).ChildNodes.Item(0).InnerText;
                iAdsBanner.Src = "../upload/home/" + logo;
                iBanner.Src = "../upload/home/" + banner;
            }
        }
        catch (Exception ex)
        {

        }
    }

    protected void LoadFooter()
    {
        try
        {
            string fname = Server.MapPath("../upload/xml/CopyRights.xml");
            if (!File.Exists(fname))
            {
                return;
            }
            XmlDocument doc = new XmlDocument();
            doc.Load(fname);
            XmlNode root = doc.DocumentElement;
            XmlNodeList list = root.ChildNodes;
            address_footer.InnerHtml = Server.HtmlDecode(list.Item(0).InnerText);
            contact_footer.InnerHtml = Server.HtmlDecode(list.Item(1).InnerText);
        }
        catch (Exception ex)
        {
            throw;
        }
    }
}
